{% extends "base.html" %}

{% block title %}智能对联生成器{% endblock %}

{% block extra_css %}
<style>
    .couplet-container {
        background-color: #f8f9fa;
        border-radius: 10px;
        padding: 20px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    .couplet-line {
        font-size: 1.5rem;
        font-weight: bold;
        text-align: center;
        margin: 15px 0;
        padding: 10px;
        border-radius: 5px;
        background-color: white;
    }
    .couplet-result {
        display: none;
    }
</style>
{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="couplet-container">
            <h2 class="text-center mb-4">智能对联生成器</h2>
            
            <div class="mb-3">
                <label for="first-line" class="form-label">上联</label>
                <input type="text" class="form-control" id="first-line" placeholder="请输入上联">
            </div>
            
            <div class="mb-3">
                <label for="style-select" class="form-label">对联风格</label>
                <select class="form-select" id="style-select">
                    <option value="traditional">传统风格</option>
                    <option value="modern">现代风格</option>
                    <option value="humorous">幽默风格</option>
                </select>
            </div>
            
            <div class="d-grid gap-2 d-md-flex justify-content-md-center mb-4">
                <button type="button" class="btn btn-primary me-md-2" id="generate-btn">
                    <i class="bi bi-magic"></i> 生成下联
                </button>
                <button type="button" class="btn btn-secondary" id="random-btn">
                    <i class="bi bi-shuffle"></i> 随机对联
                </button>
            </div>
            
            <div class="couplet-result" id="couplet-result">
                <div class="couplet-line" id="couplet-first"></div>
                <div class="couplet-line" id="couplet-second"></div>
            </div>

            <!-- 新增的对联展示区域 -->
            <div class="row mt-4">
                <div class="col-md-12">
                    <div class="card shadow-sm">
                        <div class="card-header bg-success text-white">
                            <h5 class="mb-0">对联展示</h5>
                        </div>
                        <div class="card-body">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label class="form-label fw-bold">上联</label>
                                        <div class="p-3 bg-light rounded" id="display-first"></div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label class="form-label fw-bold">下联</label>
                                        <div class="p-3 bg-light rounded" id="display-second"></div>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                                <button type="button" class="btn btn-outline-success me-md-2" id="copy-btn">
                                    <i class="bi bi-clipboard"></i> 复制对联
                                </button>
                                <button type="button" class="btn btn-outline-primary" id="save-btn">
                                    <i class="bi bi-bookmark"></i> 保存对联
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script src="{{ url_for('static', filename='js/couplet.js') }}"></script>
{% endblock %}